#include <iostream>
#include <fstream>
#include "../Headers/types.h"
#include "../Headers/log.h"

// Print raw output
void TOB::Log::raw(std::string key, std::string &message) {
  time_t rawtime;
  struct tm *timeinfo;
  std::fstream handle(LOGPATH, std::ios::out | std::ios::app);

  time(&rawtime);
  timeinfo = localtime(&rawtime);

  handle << std::endl << asctime(timeinfo);
  handle << key << ": " << message << std::endl;
  handle.close();
}


// Print event
void TOB::Log::event(std::string message) {
  Log::raw("..", message);
}


// Print warning
void TOB::Log::warning(std::string message) {
  Log::raw("!!", message);
}


// Print error
void TOB::Log::error(std::string message) {
  Log::raw("##", message);
}
